<form id="buttonEditForm" class="parsley-form" data-parsley-validate role="form" method="post" action="$!basePath/system/button/edit/do">
	<input type="hidden" name="id" value="$!button.id">
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h4 class="modal-title">编辑按钮</h4>
</div>
<div class="modal-body">
	<div class="row">
		<div class="col-xs-12">
			<div class="form-group">
				<label>名称</label>
				<input type="text" name="name" class="form-control" data-parsley-required="true" value="$!button.name"/>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-xs-12">
			<div class="form-group">
				<label>Code</label>
				<input type="text" name="code" class="form-control" data-parsley-required="true" value="$!button.code"/>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-xs-12">
			<div class="form-group">
				<label>描述</label>
				<input type="text" name="descript" class="form-control" value="$!button.descript"/>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-xs-12">
			<div class="form-group">
				<label>是否启用</label>
				<input type="checkbox" name="enabled" data-switch-blue #ifChecked($!button.enabled)/>
			</div>
		</div>
	</div>
</div>
<div class="modal-footer">
    <button id="ok" type="submit" class="btn btn-primary" data-loading-text="正在保存...">确  定</button>
    <button type="button" class="btn btn-default" data-dismiss="modal">取  消</button>
</div>
</form>
<script type="text/javascript">
	ns.ready(function(){
		ns.requireJS("/framework/js/form/form.js");
		ns.requireJS("/framework/js/form/validator.js");
		var dialog = ns.view.Dialog.getCur("#buttonEditForm");

		$("#buttonEditForm").ajaxForm({
			beforeSubmit:function(arr, $form, options){
				$form.find("#ok").button("loading");
			},
			success : function(data, statusText, xhr, $form) {
				if(data.success == true){
					ns.tip.toast.success("按钮修改成功！");
					var dialog = ns.view.Dialog.getCur($form);
					dialog.isEdited = true;
					dialog.close();
				}else{
					ns.tip.toast.error(data.error);
				}
				$form.find("#ok").button("reset");
			}
		});
	});
</script>